#ifndef XGE_GRAPHICS_ANIM_ROTATION_H_
#define XGE_GRAPHICS_ANIM_ROTATION_H_
#include "xge_common_config.h"
#include "anim.h"
#include "xallocator.h"

namespace xge{
namespace graphics{

  // AnimRotation represents a rotation class
  // that helps you to rotate a 2D Animator Receiver
  class AnimRotation : public Animator , public Allocator {
  public:
    // An animation rotation should take 2 parameter as 
    // input constructor .
    // 1. The rotate radius 
    // 2. The costing time 
    // Very frequent use is : AnimRotation( Math::PEI , 1.0 );
    // which means rotate this receiver per PEI in one second
    AnimRotation ( float radius , float seconds );
  public:
    // Do the action of this animation 
    virtual void Action( BaseNode* node , 
      const Timer::tick_t& diff_time ) {
        node->set_rotation( (diff_time)*speed_ );
    }
    // Setting the status of this animator
    // if this animator is sharing among other animator
    // this will cause all the animator change their speed
    void set_speed( float radius , float seconds ) {
      speed_ = radius / seconds ;
    }
    float speed() const {
      return speed_;
    }
  private:
    // speed of this animator
    float speed_;
  };

}
}


#endif// XGE_GRAPHICS_ANIM_ROTATION_H_